const fs = require('fs');
const globalConfig = require('./config');
const pathMap = new Map();
const files = fs.readdirSync(globalConfig['controller_path']);
files.forEach(item => {
  const temp = require('./' + globalConfig['controller_path'] + '/' + item);
  if (temp.path) {
    for (const [k, v] of temp.path) {
      if (pathMap.has(k)) {
        throw new Error(`url path 异常 url：${k}!`);
      } else {
        pathMap.set(k, v);
      }
    }
  }
});
module.exports = pathMap;